package main

import (
	"fmt"
	"golang.org/x/net/context"
	"google.golang.org/grpc"
	"net"
	"testGrpc/protobuf"
)

const prot = ":18881"
//实现HelloServer  HelloServerClient接口
type Server struct {
}

func (this *Server) SayHello(ctx context.Context,in *protobuf.HelloRequest) (*protobuf.HelloReply,error) {
     return &protobuf.HelloReply{Message:"hello "+in.Name},nil
}

func (this *Server) GetHelloMsg(ctx context.Context, in *protobuf.HelloRequest) (*protobuf.HelloMessage, error) {
	return &protobuf.HelloMessage{Msg:"this is form server haha!"},nil
}


func main() {
    listen,err:=net.Listen("tcp",prot)

    if err !=nil{
    	fmt.Println("failed to listen:",err)
		return
	}
    //得到一个grpc服务句柄
    srv:=grpc.NewServer()

}
